package com.ds.infra.rpc.core.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * RPC服务端专属配置
 *
 * @author WeiShaoying
 */
@Data
@ConfigurationProperties(prefix = "rpc.server")
public class ServerConfig {

    /**
     * 业务线程池核心大小 (默认CPU核心数)
     */
    private int corePoolSize = Runtime.getRuntime().availableProcessors();

    /**
     * 业务线程池最大大小 (默认CPU核心数*4)
     */
    private int maxPoolSize = Runtime.getRuntime().availableProcessors() * 4;

    /**
     * 线程空闲时间(s) (默认60s)
     */
    private int keepAliveTime = 60;

    /**
     * 任务队列容量 (默认1024)
     */
    private int queueCapacity = 1024;

    /**
     * 是否开启TCP_NODELAY (默认true)
     */
    private boolean tcpNoDelay = true;

    /**
     * SO_BACKLOG大小 (默认128)
     */
    private int soBacklog = 128;
}
